<?php
	
	$languages = array(0 => "ro", 1 => "en", 2 => "de");
    $language = 0;
    
    function set_language() {
        global $languages;
        global $language;
        
        if (isset($_GET['lang'])) {
            $lang = $_GET['lang'];
            if (in_array($lang, $languages)) {
                require_once("site/include/lang/lang_" . $lang . ".inc");
				$language = $lang;
            }
            else {
                require_once("site/include/lang/lang_ro.inc");
				$language = "ro";
			}
        }
        else {
            require_once("site/include/lang/lang_ro.inc");
			$language = "ro";
        }
    }
    
    function generate_numbers_and_store_result() {
    	$x = rand(1, 9);
    	$y = rand(1, 9);
    	$z = $x * $y;
    	$_SESSION['security_key'] = $z;
    	$_SESSION['number_x'] = $x;
    	$_SESSION['number_y'] = $y;
    }
    
    function renderSiteHeader() { 
        global $language;
        set_language();
        ?>
        <div id="topPan">
          <div id="topHeaderPan">
            <ul>
                <li class="company"><a href="site_despre.php?lang=<?php echo $language; ?>"><?php echo LANG_Despre; ?></a></li>
                <li><a href="site_intrebari.php?lang=<?php echo $language; ?>"><?php echo LANG_Intrebari; ?></a></li>
                <li><a href="site_firma.php?lang=<?php echo $language; ?>"><?php echo LANG_Firma; ?></a></li>
                <li><a href="site_login.php?lang=<?php echo $language; ?>"><?php echo LANG_Login; ?></a></li>
            </ul>
            <div class="pngfix" style="background: url(mages/site_images/ol_logo_r1.png);">
                <a href="index.php?lang=<?php echo $language; ?>">
                    <img width="300" height="143" border="0" src="images/site_images/ol_logo_r1.png" border="0" />
                </a>
            </div>
          </div>
          <div id="toprightPan">
            <ul>
                <li class="home"><a href="index.php?lang=<?php echo $language; ?>"><?php echo LANG_Home; ?></a></li>
                <li class="about"><br><a href="index.php?lang=ro"><img border="0" src="images/site_images/romania.jpg"></a>&nbsp;&nbsp;&nbsp;<a href="index.php?lang=en"><img border="0" src="images/site_images/statele_unite.jpg"></a>&nbsp;</li>
                <li class="contact"><a href="site_contact.php?lang=<?php echo $language; ?>"><?php echo LANG_Contact; ?></a></li>
            </ul>
          </div>
        </div>
    <?php
    }
    
    function render_footer_site($no_trafic = false) {
        global $language;
        ?>
        <div id="footermainPan">
          <div id="footerPan">
            <ul>
              <li><a href="index.php?lang=<?php echo $language; ?>"><?php echo LANG_Home; ?></a>| </li>
              <li><a href="site_despre.php?lang=<?php echo $language; ?>"><?php echo LANG_Despre; ?></a> | </li>
              <li><a href="site_intrebari.php?lang=<?php echo $language; ?>"><?php echo LANG_Intrebari; ?></a> |</li>
              <li><a href="site_contact.php?lang=<?php echo $language; ?>"><?php echo LANG_Contact; ?></a> </li>
            </ul>
            
          </div>
          <?php
			if (!$no_trafic) {
		  ?>
          <div align="center">
			<!--/Start Trafic.ro/-->
			<script type="text/javascript">t_rid="onlinelogisticseu";</script>
			<script type="text/javascript" src="http://storage.trafic.ro/js/trafic.js"
			></script><noscript><a href="http://www.trafic.ro/top/?rid=onlinelogisticseu"
			 target="_blank"><img border="0" alt="trafic ranking"
			 src="http://log.trafic.ro/cgi-bin/pl.dll?rid=onlinelogisticseu"/></a>
			<a href="http://www.trafic.ro">Statistici web</a>
			</noscript>
			<!--/End Trafic.ro/-->
			</div>
        </div>
        <?php
			}
        ?>
        <?php    
    }
    
    set_language();
?>